<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no,minimal-ui">
    <meta name="apple-mobile-web-app-capable" content="yes" />
    <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
    <meta name="apple-mobile-web-app-title" content="阿福易购">
    <meta content="telephone=no" name="format-detection" />
    <meta content="email=no" name="format-detection" />
    <!-- uc、qq浏览器 -->
    <meta name="screen-orientation" content="portrait">
    <meta name="full-screen" content="yes">
    <meta name="browsermode" content="application">
    <meta name="x5-orientation" content="portrait">
    <meta name="x5-fullscreen" content="true">
    <meta name="x5-page-mode" content="app">
    <meta name="HandheldFriendly" content="true">
    <meta name="MobileOptimized" content="320">
    <meta name="csrf-token" content="{{ csrf_token() }}" />
    <meta name="keywords" content="{{$SEO['keywords']}}"/>
    <meta name="description" content="{{$SEO['description']}}"/>
    <title>领取优惠券_{{$SEO['title']}}</title>
    <link rel="stylesheet" href="{{ asset('/build/css/app.min.css') }}">
</head>
<body ontouchstart="">

@inject('couponService','App\Interfaces\CouponService')

<header class="ui-header ui-header-stable    af-header">
    <ul class="ui-row-flex">
        <li class="ui-col ui-flex ui-flex-pack-start">
            <i class="ui-icon-return af-icon-home" ontouchstart="window.history.back();"></i>
        </li>
        <li class="ui-col ui-flex ui-flex-pack-center">
            <h1>领取优惠券</h1>
        </li>
        <li class="ui-col ui-flex ui-flex-pack-end">

        </li>
    </ul>
</header>

<?php $coupons = @$couponService->getCanReceiveCoupon(@$goods_id); ?>

<div class="ui-container" >
    <div class="ui-tab ui-my-order-tab">
        <ul class="ui-tab-content-">
            <li>
                <ul class="J-list my-coupon">
                    @if(@$coupons)
                        @foreach($coupons as $key=>$item)

                            @if($item->amount<=$item->receive_amount) <?php continue; ?> @endif
                            <li class="item" data-id="{{$item->id}}">
                                <!-- 效果1 begin -->
                                <div class="stamp stamp01">
                                    <div class="par">
                                        <p>
                                            <?php
                                                switch ($item->type) {
                                                    case '1':
                                                        echo '全场通用券';
                                                        break;
                                                    case '2':
                                                        echo '商品优惠券';
                                                        break;
                                                    case '3':
                                                        echo '分类优惠券';
                                                        break;
                                                    case '4':
                                                        echo '店铺优惠券';
                                                        break;
                                                    case '5':
                                                        echo '品牌优惠券';
                                                        break;
                                                }//end switch()
                                            ?>
                                        </p>
                                        <sub class="sign">￥</sub><span>{{$item->value}}</span>@if($item->limit_fir)<p>订单满{{$item->limit_fir}}元</p> @endif</div>
                                    <div class="copy">副券<p><?php $date = date_create($item->start_time);echo trim(date_format($date, 'Y-m-d')); ?><br><?php $date = date_create($item->end_time);echo trim(date_format($date, 'Y-m-d')); ?></p></div>
                                    <i></i>
                                    <span class="ui-already-receive af-hide" style="background-image:url(/build/images/already-receive.png)"></span>
                                </div>
                                <!-- 效果1 end -->
                            </li>
                        @endforeach
                    @endif
                </ul>

            </li>
            <li></li>
            <li></li>
        </ul>
    </div>

</div>
<footer>

</footer>


<script src="{{ asset('/build/lib/zepto.min.js') }}"></script>
<script src="{{ asset('/build/js/frozen.js') }}"></script>
<script src="{{ asset('/build/js/app.min.js') }}"></script>
<script>
    $(function () {
       $('.J-list').on('click','.item',function () {
         var that=$(this),id=that.attr('data-id');
           MyAjax('/my/coupon','post',{coupon_id:id},function (res) {
               that.find('.ui-already-receive').show();
               that.removeClass('item');
           });
       });
    });
</script>

</body>
</html>